package util;

import com.syzygy.service.PictureService;
import com.syzygy.service.impl.PictureServiceImpl;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

//@RunWith(SpringJUnit4ClassRunner.class)
//@ContextConfiguration({"classpath:spring.xml"})  //配置文件写法   这两种写法取决于你的spring核心配置是注解形式还是xml形式，选其一就可以了
@Component
public class PictureUtils {
    @Autowired
    PictureService pictureService;

    public String getPictureId(){
//        PictureServiceImpl pictureService1 = new PictureServiceImpl();
        String pictureId = RandomUtils.generateString(10);
        if(null == pictureService.getPictureById(pictureId)){
            return pictureId;
        }else {
            return getPictureId();
        }
    }


}

